from django.contrib import admin
from django.urls import path, include
from .views import StudentViewSet,ClassesViewSet
from rest_framework.routers import DefaultRouter
urlpatterns = [
    # post ==>create方法
    # get ==》list方法
    # get /id ==> retrieve方法
    # delete /id  ==> destroy方法
    # 127.0.0.1:8000/drfstudy/studnets
    # path("students/",StudentViewSet.as_view({"get": "list","post": "create"})),
    # path("students/<pk>/",StudentViewSet.as_view({"get": "retrieve","put":"update","delete":"destroy"})),
]

router = DefaultRouter() # 创建路由对象
#127.0.0.1:8000/drfstudy/students/
router.register('students', StudentViewSet)
#127.0.0.1:8000/drfstudy/classes/
router.register('classes', ClassesViewSet)
urlpatterns += router.urls



